<template>
    <div class="w-index-rec">
        <div class="w-index-rec-title">样板间推荐</div>
        <div class="w-index-rec-list">
          <div class="w-index-rec-list-item" v-for="(item,i) in roomList" :key="i" @click="goPage(item.id)">
            <div class="img">
              <img :src="item.logo">
              <div class="style-price">
                <div class="style">{{item.style}}</div>
                <div class="price">¥{{item.goodsPrice ? item.goodsPrice : 0}}</div>
              </div>
            </div>
            <div class="name-hx-size">
              <span class="name">{{item.lpModel.name}}</span>
              <div class="hx-size">
                <img src="@/assets/images/Group201.png" alt="">
                <span class="hx">{{item.houseModel.name}}{{item.houseModel.bedRoom}}{{item.houseModel.livRoom}}</span>
                <img src="@/assets/images/area.png" alt="">
                <span class="size">{{item.houseModel.area}}㎡</span>
              </div>
            </div>
            <div class="address">
              <img src="@/assets/images/addr.png" alt="">
              <span>{{item.lpModel.prov}}{{item.lpModel.city}}{{item.lpModel.dist}}{{item.lpModel.addr}}</span>
            </div>
        </div>
        <div v-infinite-scroll="loadMore" infinite-scroll-disabled="busy" infinite-scroll-distance="10" class="footer-txt">
        </div>
      </div>
    </div>
</template>

<script>
export default {
  props: ["roomList", "total"],

  data() {
    return {
      busy: false
    };
  },
  methods: {
    goPage(id) {
      this.$router.push({
        path: "/rcmdetail",
        query: { id: id }
      });
    },
    loadMore() {
      this.busy = false;
      this.$emit("getRoom");
      if (this.roomList.length == this.total && this.roomList.length != 0) {
        this.busy = true;
      }
      // console.log(this.roomList.length + "=======" + this.total);
    }
  }
};
</script>

<style lang="scss">
.w-index-rec {
  padding: 60px 48px 24px;
  margin-top: 20px;
  background: #fff;
  .w-index-rec-title {
    font-size: 36px;
    color: #333333;
    font-weight: 500;
    padding-right: 24px;
    line-height: 36px;
    margin-bottom: 24px;
  }
  .w-index-rec-list {
    .w-index-rec-list-item {
      .img {
        position: relative;
        height: 588px;
        width: 100%;
        .style-price {
          position: absolute;
          left: 30px;
          bottom: 40px;
          .style,
          .price {
            display: inline-block;
            vertical-align: middle;
            background: #f39604;
            width: 220px;
            height: 52px;
            line-height: 52px;
            border-radius: 20px;
            color: #fff;
            font-size: 28px;
            text-align: center;
          }
          .price {
            margin-left: 20px;
          }
        }
      }
      img {
        height: 100%;
        width: 100%;
      }

      .name-hx-size {
        padding: 28px 0 24px;
        font-weight: 400;
        line-height: 32px;

        img {
          width: 32px;
          height: 32px;
          vertical-align: middle;
          margin-right: 20px;
          margin-top: -10px;
        }

        .name {
          font-size: 32px;
          font-weight: 500;
        }
        .hx-size {
          font-size: 28px;
          float: right;
          vertical-align: middle;
        }
        .hx {
          margin-right: 32px;
        }
        .size {
        }
      }
      .address {
        font-size: 28px;
        padding-bottom: 30px;

        img {
          width: 22px;
          height: 32px;
          margin-right: 20px;
          margin-top: -5px;
          vertical-align: middle;
        }
      }
    }
  }
  .footer-txt {
    font-size: 24px;
    text-align: center;
  }
}
</style>